import request from '../utils/request.js'

// 告警信息管理列表
export function fetchWarnAdminList(query) {
    return request({
        url: '/bms/alerts/list/',
        method: 'get',
        params: query
    })
}

// 告警信息设为已读 (当前行的标记)
export function modifyWarnInfo(id, data) {
    return request({
        url: `/bms/alerts/${id}/`,
        method: 'put',
        data
    })
}

// 告警信息设为已读 (全部标记)
export function modifyAllWarnInfo(data) {
    return request({
        url: `/bms/alerts/readall/`,
        method: 'post',
        data
    })
}

// 系统告警查询 - 资产
export function fetchSetupList(query) {
    return request({
        url: '/bms/alert/thresholds/equip/',
        method: 'get',
        params: query
    })
}

// 系统告警设置 - 资产
export function setSetupInfo(id, data) {
    return request({
        url: `/bms/alert/thresholds/equip/${id}/`,
        method: 'patch',
        data
    })
}

// 获取系统告警查询编辑中的名称列表 - 监测点位
export function fetchSiteNameList(query) {
    return request({
        url: '/bms/alert/thresholds/point/alert-name/',
        method: 'get',
        params: query
    })
}
// 获取系统告警查询 - 监测点位
export function fetchSiteList(query) {
    return request({
        url: '/bms/alert/thresholds/point/',
        method: 'get',
        params: query
    })
}

// 添加系统告警设置 - 监测点位
export function addSiteInfo(data) {
    return request({
        url: `/bms/alert/thresholds/point/`,
        method: 'post',
        data
    })
}

// 设置系统告警设置 - 监测点位
export function setSiteInfo(id, data) {
    return request({
        url: `/bms/alert/thresholds/point/${id}/`,
        method: 'patch',
        data
    })
}
// 删除系统告警设置 - 监测点位
export function deleteSiteInfo(id) {
    return request({
        url: `/bms/alert/thresholds/point/${id}/`,
        method: 'delete'
    })
}
// 关注人员 - 资产
export function fetchConPerson(query) {
    return request({
        url: '/organizer/concern/equip/list/',
        method: 'get',
        params: query
    })
}

// 关注人员 - 资产
export function setIsConcerns(data) {
    return request({
        url: `/organizer/concern/equip/`,
        method: 'patch',
        data
    })
}

// 关注人员 - 点位
export function fetchSiteConPerson(query) {
    return request({
        url: '/organizer/concern/point/',
        method: 'get',
        params: query
    })
}

// 关注人员 - 点位
export function setSiteConcerns(data) {
    return request({
        url: `/organizer/concern/point/`,
        method: 'patch',
        data
    })
}

// 获取告警通知方式
export function getWarnNotice(query) {
    return request({
        url: '/bms/alert/notify/',
        method: 'get',
        params: query
    })
}

// 修改告警通知方式
export function setNoticeWay(id, data) {
    return request({
        url: `/bms/alert/notify/${id}/`,
        method: 'patch',
        data
    })
}

// 获取告警工作模式下拉框内容
export function getWarnMode(id) {
    let _url
    if (id) _url = `/bms/alert/work-mode/${id}/`
    if (!id) _url = `/bms/alert/work-mode/`
    return request({
        url: _url,
        method: 'get'
    })
}
// 增加告警工作模式
export function upDateWarnMode(data) {
    return request({
        url: '/bms/alert/work-mode/',
        method: 'post',
        data
    })
}
// 修改告警工作模式
export function setWarnMode(id, data) {
    return request({
        url: `/bms/alert/work-mode/${id}/`,
        method: 'patch',
        data
    })
}
// 删除告警工作模式
export function delWarnMode(id) {
    return request({
        url: `/bms/alert/work-mode/${id}/`,
        method: 'delete'
    })
}

// 系统告警查询-全局
export function fetchGlobalSetupList(query) {
    return request({
        url: '/bms/param-setup/',
        method: 'get',
        params: query
    })
}

// 系统告警设置-全局
export function setGlobalSetupInfo(data) {
    return request({
        url: `/bms/param-setup/`,
        method: 'patch',
        data
    })
}

// 获取系统升级的进度
export function getUpgrapeSys() {
    return request({
        url: '/bms/upgrade/',
        method: 'get'
    })
}

export function getPostFile(data) {
    return request({
        url: '/bms/upgrade/',
        method: 'post',
        data
    })
}

// 版本号
export function getVersionsInfo() {
    return request({
        url: '/bms/versions/',
        method: 'get'
    })
}